Carbon


SetControlValue

Header: Controls.h Carbon status: Supported

Changes the current setting of a control and redraws it accordingly.

void SetControlValue (
    ControlRef theControl, 
    SInt16 newValue
);
theControl

A handle to the control whose current setting you wish to change.

newValue

The new setting for the control.

DISCUSSION

For controls whose values the user can set, you can use the SetControlValue function to change the contrlValue field of the control structure to the specified value and redraw the control to reflect the new setting. For checkboxes and radio buttons, the value 1 fills the control with the appropriate mark, and 0 removes the mark. For Mac OS 8 checkboxes and radio buttons, 2 represents a mixed state; see “Checkbox Value Constants” and “Radio Button Value Constants”. For scroll bars, SetControlValue redraws the scroll box where appropriate.

If the specified value is less than the minimum setting for the control, SetControlValue sets the control to its minimum setting; if the value is greater than the maximum setting, SetControlValue sets the control to its maximum.

When you create a control, you specify an initial setting either in the control resource or in the value parameter of the function NewControl. To determine a control’s current setting before changing it in response to a user’s click in that control, use the function GetControlValue.

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)